package com.hzcx.app.simplechat.ui.publicui.presenter;

import android.content.Context;

import com.hzcx.app.simplechat.api.BaseDialogObserver;
import com.hzcx.app.simplechat.base.BasePresenter;
import com.hzcx.app.simplechat.model.PublicModel;
import com.hzcx.app.simplechat.model.UserModel;
import com.hzcx.app.simplechat.ui.chat.event.ChatShareUserEvent;
import com.hzcx.app.simplechat.ui.publicui.bean.ShareInfoBean;
import com.hzcx.app.simplechat.ui.publicui.contract.CaptureContract;
import com.hzcx.app.simplechat.ui.publicui.contract.ShareContract;
import com.hzcx.app.simplechat.ui.user.bean.UserInfoBean;
import com.hzcx.app.simplechat.util.UserInfoUtil;

public class SharePresenter extends BasePresenter<ShareContract.View> implements ShareContract.Presenter {

    /**
     * 获取分享内容
     *
     * @param context
     * @param id
     */
    @Override
    public void getShareInfo(Context context, int id, int tag) {
        PublicModel.getShareInfo(context, id, new BaseDialogObserver<ShareInfoBean>(context) {
            @Override
            protected void onSuccess(ShareInfoBean data) {
                mView.shareResult(data, tag);
            }
        });
    }

    /**
     * 获取用户信息
     *
     * @param context
     * @param member_id
     */
    @Override
    public void getUserInfo(Context context, int member_id, ChatShareUserEvent event) {
        UserModel.getUserInfo(context, member_id, new BaseDialogObserver<UserInfoBean>(context) {
            @Override
            protected void onSuccess(UserInfoBean data) {
                mView.userInfoResult(data, event);
            }
        });
    }
}
